package com.xxxx

import org.apache.flink.api.scala.{DataSet, ExecutionEnvironment}

object WordCountBatchByScala {
  def main(args: Array[String]) = {
    //创建环境
    val environment = ExecutionEnvironment.getExecutionEnvironment;
    //获取数据源
    val source: DataSet[String] = environment.readTextFile("data/dataset.txt");
    //开始转换
    import org.apache.flink.api.scala._;
    source.flatMap(_.split(" ")).map((_, 1)).groupBy(0).sum(1).print;
  }
}
